<?php
$this->breadcrumbs=array(
		'access',
		'group',
		'manage'
	);
?>


<?php
		Yii::app()->clientScript->registerScript('search', "
		$('.search-button').click(function(){
			$('.search-form').toggle();
			return false;
		});
		$('.search-form form').submit(function(){
			$.fn.yiiGridView.update('group-grid', {
				data: $(this).serialize()
			});
			return false;
		});
		");
?>
<div class="admin_table">
<h1>Manage Group</h1>

<div class="nav_wrap">
<?php echo CHtml::link('Create New Group',array('group/create')); ?>
<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
</div>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->


<?php if(Yii::app()->user->hasFlash('success')):?>
    <div style="color: green;" class="info">
        <?php echo '<b>'.Yii::app()->user->getFlash('success').'</b>'; ?>
    </div>
<?php endif; ?>
<?php
Yii::app()->clientScript->registerScript(
   'myHideEffect',
   '$(".info").animate({opacity: 1.0}, 3000).fadeOut("slow");',
   CClientScript::POS_READY
);
?>

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'group-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		array('name'=>'id','htmlOptions'=>array('width'=>'10')),
		array('name'=>'name','htmlOptions'=>array('width'=>'250')),
		array(
			'class'=>'CButtonColumn',
		 	'afterDelete'=>'function(link,success,data){ if(success) $("#statusMsg").html(data); }',
			'template' => '{update} {delete}',
			),
		),
	));
?>	
</div>